home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / info / lispref.info-26 < prev    next >
Encoding:
GNU Info File  |  1995-09-01  |  42.3 KB  |  987 lines

  1. This is Info file ../../info/lispref.info, produced by Makeinfo-1.63
  2. from the input file lispref.texi.
  3.  
  4.    Edition History:
  5.  
  6.    GNU Emacs Lisp Reference Manual Second Edition (v2.01), May 1993 GNU
  7. Emacs Lisp Reference Manual Further Revised (v2.02), August 1993 Lucid
  8. Emacs Lisp Reference Manual (for 19.10) First Edition, March 1994
  9. XEmacs Lisp Programmer's Manual (for 19.12) Second Edition, April 1995
  10. GNU Emacs Lisp Reference Manual v2.4, June 1995 XEmacs Lisp
  11. Programmer's Manual (for 19.13) Third Edition, July 1995
  12.  
  13.    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software
  14. Foundation, Inc.  Copyright (C) 1994, 1995 Sun Microsystems, Inc.
  15. Copyright (C) 1995 Amdahl Corporation.  Copyright (C) 1995 Ben Wing.
  16.  
  17.    Permission is granted to make and distribute verbatim copies of this
  18. manual provided the copyright notice and this permission notice are
  19. preserved on all copies.
  20.  
  21.    Permission is granted to copy and distribute modified versions of
  22. this manual under the conditions for verbatim copying, provided that the
  23. entire resulting derived work is distributed under the terms of a
  24. permission notice identical to this one.
  25.  
  26.    Permission is granted to copy and distribute translations of this
  27. manual into another language, under the above conditions for modified
  28. versions, except that this permission notice may be stated in a
  29. translation approved by the Foundation.
  30.  
  31.    Permission is granted to copy and distribute modified versions of
  32. this manual under the conditions for verbatim copying, provided also
  33. that the section entitled "GNU General Public License" is included
  34. exactly as in the original, and provided that the entire resulting
  35. derived work is distributed under the terms of a permission notice
  36. identical to this one.
  37.  
  38.    Permission is granted to copy and distribute translations of this
  39. manual into another language, under the above conditions for modified
  40. versions, except that the section entitled "GNU General Public License"
  41. may be included in a translation approved by the Free Software
  42. Foundation instead of in the original English.
  43.  
  44. 
  45. File: lispref.info,  Node: Commands for Insertion,  Next: Deletion,  Prev: Insertion,  Up: Text
  46.  
  47. User-Level Insertion Commands
  48. =============================
  49.  
  50.    This section describes higher-level commands for inserting text,
  51. commands intended primarily for the user but useful also in Lisp
  52. programs.
  53.  
  54.  - Command: insert-buffer FROM-BUFFER-OR-NAME
  55.      This command inserts the entire contents of FROM-BUFFER-OR-NAME
  56.      (which must exist) into the current buffer after point.  It leaves
  57.      the mark after the inserted text.  The value is `nil'.
  58.  
  59.  - Command: self-insert-command COUNT
  60.      This command inserts the last character typed; it does so COUNT
  61.      times, before point, and returns `nil'.  Most printing characters
  62.      are bound to this command.  In routine use, `self-insert-command'
  63.      is the most frequently called function in XEmacs, but programs
  64.      rarely use it except to install it on a keymap.
  65.  
  66.      In an interactive call, COUNT is the numeric prefix argument.
  67.  
  68.      This command calls `auto-fill-function' whenever that is non-`nil'
  69.      and the character inserted is a space or a newline (*note Auto
  70.      Filling::.).
  71.  
  72.      This command performs abbrev expansion if Abbrev mode is enabled
  73.      and the inserted character does not have word-constituent syntax.
  74.      (*Note Abbrevs::, and *Note Syntax Class Table::.)
  75.  
  76.      This is also responsible for calling `blink-paren-function' when
  77.      the inserted character has close parenthesis syntax (*note
  78.      Blinking::.).
  79.  
  80.  - Command: newline &optional NUMBER-OF-NEWLINES
  81.      This command inserts newlines into the current buffer before point.
  82.      If NUMBER-OF-NEWLINES is supplied, that many newline characters
  83.      are inserted.
  84.  
  85.      This function calls `auto-fill-function' if the current column
  86.      number is greater than the value of `fill-column' and
  87.      NUMBER-OF-NEWLINES is `nil'.  Typically what `auto-fill-function'
  88.      does is insert a newline; thus, the overall result in this case is
  89.      to insert two newlines at different places: one at point, and
  90.      another earlier in the line.  `newline' does not auto-fill if
  91.      NUMBER-OF-NEWLINES is non-`nil'.
  92.  
  93.      This command indents to the left margin if that is not zero.
  94.      *Note Margins::.
  95.  
  96.      The value returned is `nil'.  In an interactive call, COUNT is the
  97.      numeric prefix argument.
  98.  
  99.  - Command: split-line
  100.      This command splits the current line, moving the portion of the
  101.      line after point down vertically so that it is on the next line
  102.      directly below where it was before.  Whitespace is inserted as
  103.      needed at the beginning of the lower line, using the `indent-to'
  104.      function.  `split-line' returns the position of point.
  105.  
  106.      Programs hardly ever use this function.
  107.  
  108.  - Variable: overwrite-mode
  109.      This variable controls whether overwrite mode is in effect: a
  110.      non-`nil' value enables the mode.  It is automatically made
  111.      buffer-local when set in any fashion.
  112.  
  113. 
  114. File: lispref.info,  Node: Deletion,  Next: User-Level Deletion,  Prev: Commands for Insertion,  Up: Text
  115.  
  116. Deleting Text
  117. =============
  118.  
  119.    Deletion means removing part of the text in a buffer, without saving
  120. it in the kill ring (*note The Kill Ring::.).  Deleted text can't be
  121. yanked, but can be reinserted using the undo mechanism (*note Undo::.).
  122. Some deletion functions do save text in the kill ring in some special
  123. cases.
  124.  
  125.    All of the deletion functions operate on the current buffer, and all
  126. return a value of `nil'.
  127.  
  128.  - Function: erase-buffer
  129.      This function deletes the entire text of the current buffer,
  130.      leaving it empty.  If the buffer is read-only, it signals a
  131.      `buffer-read-only' error.  Otherwise, it deletes the text without
  132.      asking for any confirmation.  It returns `nil'.
  133.  
  134.      Normally, deleting a large amount of text from a buffer inhibits
  135.      further auto-saving of that buffer "because it has shrunk".
  136.      However, `erase-buffer' does not do this, the idea being that the
  137.      future text is not really related to the former text, and its size
  138.      should not be compared with that of the former text.
  139.  
  140.  - Command: delete-region START END &optional BUFFER
  141.      This command deletes the text in BUFFER in the region defined by
  142.      START and END.  The value is `nil'.  If optional argument BUFFER
  143.      is `nil', the current buffer is assumed.
  144.  
  145.  - Command: delete-char COUNT &optional KILLP
  146.      This command deletes COUNT characters directly after point, or
  147.      before point if COUNT is negative.  If KILLP is non-`nil', then it
  148.      saves the deleted characters in the kill ring.
  149.  
  150.      In an interactive call, COUNT is the numeric prefix argument, and
  151.      KILLP is the unprocessed prefix argument.  Therefore, if a prefix
  152.      argument is supplied, the text is saved in the kill ring.  If no
  153.      prefix argument is supplied, then one character is deleted, but
  154.      not saved in the kill ring.
  155.  
  156.      The value returned is always `nil'.
  157.  
  158.  - Command: delete-backward-char COUNT &optional KILLP
  159.      This command deletes COUNT characters directly before point, or
  160.      after point if COUNT is negative.  If KILLP is non-`nil', then it
  161.      saves the deleted characters in the kill ring.
  162.  
  163.      In an interactive call, COUNT is the numeric prefix argument, and
  164.      KILLP is the unprocessed prefix argument.  Therefore, if a prefix
  165.      argument is supplied, the text is saved in the kill ring.  If no
  166.      prefix argument is supplied, then one character is deleted, but
  167.      not saved in the kill ring.
  168.  
  169.      The value returned is always `nil'.
  170.  
  171.  - Command: backward-delete-char-untabify COUNT &optional KILLP
  172.      This command deletes COUNT characters backward, changing tabs into
  173.      spaces.  When the next character to be deleted is a tab, it is
  174.      first replaced with the proper number of spaces to preserve
  175.      alignment and then one of those spaces is deleted instead of the
  176.      tab.  If KILLP is non-`nil', then the command saves the deleted
  177.      characters in the kill ring.
  178.  
  179.      Conversion of tabs to spaces happens only if COUNT is positive.
  180.      If it is negative, exactly -COUNT characters after point are
  181.      deleted.
  182.  
  183.      In an interactive call, COUNT is the numeric prefix argument, and
  184.      KILLP is the unprocessed prefix argument.  Therefore, if a prefix
  185.      argument is supplied, the text is saved in the kill ring.  If no
  186.      prefix argument is supplied, then one character is deleted, but
  187.      not saved in the kill ring.
  188.  
  189.      The value returned is always `nil'.
  190.  
  191. 
  192. File: lispref.info,  Node: User-Level Deletion,  Next: The Kill Ring,  Prev: Deletion,  Up: Text
  193.  
  194. User-Level Deletion Commands
  195. ============================
  196.  
  197.    This section describes higher-level commands for deleting text,
  198. commands intended primarily for the user but useful also in Lisp
  199. programs.
  200.  
  201.  - Command: delete-horizontal-space
  202.      This function deletes all spaces and tabs around point.  It returns
  203.      `nil'.
  204.  
  205.      In the following examples, we call `delete-horizontal-space' four
  206.      times, once on each line, with point between the second and third
  207.      characters on the line each time.
  208.  
  209.           ---------- Buffer: foo ----------
  210.           I -!-thought
  211.           I -!-     thought
  212.           We-!- thought
  213.           Yo-!-u thought
  214.           ---------- Buffer: foo ----------
  215.           
  216.           (delete-horizontal-space)   ; Four times.
  217.                => nil
  218.           
  219.           ---------- Buffer: foo ----------
  220.           Ithought
  221.           Ithought
  222.           Wethought
  223.           You thought
  224.           ---------- Buffer: foo ----------
  225.  
  226.  - Command: delete-indentation &optional JOIN-FOLLOWING-P
  227.      This function joins the line point is on to the previous line,
  228.      deleting any whitespace at the join and in some cases replacing it
  229.      with one space.  If JOIN-FOLLOWING-P is non-`nil',
  230.      `delete-indentation' joins this line to the following line
  231.      instead.  The value is `nil'.
  232.  
  233.      If there is a fill prefix, and the second of the lines being joined
  234.      starts with the prefix, then `delete-indentation' deletes the fill
  235.      prefix before joining the lines.  *Note Margins::.
  236.  
  237.      In the example below, point is located on the line starting
  238.      `events', and it makes no difference if there are trailing spaces
  239.      in the preceding line.
  240.  
  241.           ---------- Buffer: foo ----------
  242.           When in the course of human
  243.           -!-    events, it becomes necessary
  244.           ---------- Buffer: foo ----------
  245.           
  246.           (delete-indentation)
  247.                => nil
  248.           ---------- Buffer: foo ----------
  249.           When in the course of human-!- events, it becomes necessary
  250.           ---------- Buffer: foo ----------
  251.  
  252.      After the lines are joined, the function `fixup-whitespace' is
  253.      responsible for deciding whether to leave a space at the junction.
  254.  
  255.  - Function: fixup-whitespace
  256.      This function replaces all the white space surrounding point with
  257.      either one space or no space, according to the context.  It
  258.      returns `nil'.
  259.  
  260.      At the beginning or end of a line, the appropriate amount of space
  261.      is none.  Before a character with close parenthesis syntax, or
  262.      after a character with open parenthesis or expression-prefix
  263.      syntax, no space is also appropriate.  Otherwise, one space is
  264.      appropriate.  *Note Syntax Class Table::.
  265.  
  266.      In the example below, `fixup-whitespace' is called the first time
  267.      with point before the word `spaces' in the first line.  For the
  268.      second invocation, point is directly after the `('.
  269.  
  270.           ---------- Buffer: foo ----------
  271.           This has too many     -!-spaces
  272.           This has too many spaces at the start of (-!-   this list)
  273.           ---------- Buffer: foo ----------
  274.  
  275.           (fixup-whitespace)
  276.                => nil
  277.           (fixup-whitespace)
  278.                => nil
  279.  
  280.           ---------- Buffer: foo ----------
  281.           This has too many spaces
  282.           This has too many spaces at the start of (this list)
  283.           ---------- Buffer: foo ----------
  284.  
  285.  - Command: just-one-space
  286.      This command replaces any spaces and tabs around point with a
  287.      single space.  It returns `nil'.
  288.  
  289.  - Command: delete-blank-lines
  290.      This function deletes blank lines surrounding point.  If point is
  291.      on a blank line with one or more blank lines before or after it,
  292.      then all but one of them are deleted.  If point is on an isolated
  293.      blank line, then it is deleted.  If point is on a nonblank line,
  294.      the command deletes all blank lines following it.
  295.  
  296.      A blank line is defined as a line containing only tabs and spaces.
  297.  
  298.      `delete-blank-lines' returns `nil'.
  299.  
  300. 
  301. File: lispref.info,  Node: The Kill Ring,  Next: Undo,  Prev: User-Level Deletion,  Up: Text
  302.  
  303. The Kill Ring
  304. =============
  305.  
  306.    "Kill" functions delete text like the deletion functions, but save
  307. it so that the user can reinsert it by "yanking".  Most of these
  308. functions have `kill-' in their name.  By contrast, the functions whose
  309. names start with `delete-' normally do not save text for yanking
  310. (though they can still be undone); these are "deletion" functions.
  311.  
  312.    Most of the kill commands are primarily for interactive use, and are
  313. not described here.  What we do describe are the functions provided for
  314. use in writing such commands.  You can use these functions to write
  315. commands for killing text.  When you need to delete text for internal
  316. purposes within a Lisp function, you should normally use deletion
  317. functions, so as not to disturb the kill ring contents.  *Note
  318. Deletion::.
  319.  
  320.    Killed text is saved for later yanking in the "kill ring".  This is
  321. a list that holds a number of recent kills, not just the last text
  322. kill.  We call this a "ring" because yanking treats it as having
  323. elements in a cyclic order.  The list is kept in the variable
  324. `kill-ring', and can be operated on with the usual functions for lists;
  325. there are also specialized functions, described in this section, that
  326. treat it as a ring.
  327.  
  328.    Some people think this use of the word "kill" is unfortunate, since
  329. it refers to operations that specifically *do not* destroy the entities
  330. "killed".  This is in sharp contrast to ordinary life, in which death
  331. is permanent and "killed" entities do not come back to life.
  332. Therefore, other metaphors have been proposed.  For example, the term
  333. "cut ring" makes sense to people who, in pre-computer days, used
  334. scissors and paste to cut up and rearrange manuscripts.  However, it
  335. would be difficult to change the terminology now.
  336.  
  337. * Menu:
  338.  
  339. * Kill Ring Concepts::     What text looks like in the kill ring.
  340. * Kill Functions::         Functions that kill text.
  341. * Yank Commands::          Commands that access the kill ring.
  342. * Low-Level Kill Ring::       Functions and variables for kill ring access.
  343. * Internals of Kill Ring:: Variables that hold kill-ring data.
  344.  
  345. 
  346. File: lispref.info,  Node: Kill Ring Concepts,  Next: Kill Functions,  Up: The Kill Ring
  347.  
  348. Kill Ring Concepts
  349. ------------------
  350.  
  351.    The kill ring records killed text as strings in a list, most recent
  352. first.  A short kill ring, for example, might look like this:
  353.  
  354.      ("some text" "a different piece of text" "even older text")
  355.  
  356. When the list reaches `kill-ring-max' entries in length, adding a new
  357. entry automatically deletes the last entry.
  358.  
  359.    When kill commands are interwoven with other commands, each kill
  360. command makes a new entry in the kill ring.  Multiple kill commands in
  361. succession build up a single entry in the kill ring, which would be
  362. yanked as a unit; the second and subsequent consecutive kill commands
  363. add text to the entry made by the first one.
  364.  
  365.    For yanking, one entry in the kill ring is designated the "front" of
  366. the ring.  Some yank commands "rotate" the ring by designating a
  367. different element as the "front."  But this virtual rotation doesn't
  368. change the list itself--the most recent entry always comes first in the
  369. list.
  370.  
  371. 
  372. File: lispref.info,  Node: Kill Functions,  Next: Yank Commands,  Prev: Kill Ring Concepts,  Up: The Kill Ring
  373.  
  374. Functions for Killing
  375. ---------------------
  376.  
  377.    `kill-region' is the usual subroutine for killing text.  Any command
  378. that calls this function is a "kill command" (and should probably have
  379. `kill' in its name).  `kill-region' puts the newly killed text in a new
  380. element at the beginning of the kill ring or adds it to the most recent
  381. element.  It uses the `last-command' variable to determine whether the
  382. previous command was a kill command, and if so appends the killed text
  383. to the most recent entry.
  384.  
  385.  - Command: kill-region START END
  386.      This function kills the text in the region defined by START and
  387.      END.  The text is deleted but saved in the kill ring, along with
  388.      its text properties.  The value is always `nil'.
  389.  
  390.      In an interactive call, START and END are point and the mark.
  391.  
  392.      If the buffer is read-only, `kill-region' modifies the kill ring
  393.      just the same, then signals an error without modifying the buffer.
  394.      This is convenient because it lets the user use all the kill
  395.      commands to copy text into the kill ring from a read-only buffer.
  396.  
  397.  - Command: copy-region-as-kill START END
  398.      This command saves the region defined by START and END on the kill
  399.      ring (including text properties), but does not delete the text
  400.      from the buffer.  It returns `nil'.  It also indicates the extent
  401.      of the text copied by moving the cursor momentarily, or by
  402.      displaying a message in the echo area.
  403.  
  404.      The command does not set `this-command' to `kill-region', so a
  405.      subsequent kill command does not append to the same kill ring
  406.      entry.
  407.  
  408.      Don't call `copy-region-as-kill' in Lisp programs unless you aim to
  409.      support Emacs 18.  For Emacs 19, it is better to use `kill-new' or
  410.      `kill-append' instead.  *Note Low-Level Kill Ring::.
  411.  
  412. 
  413. File: lispref.info,  Node: Yank Commands,  Next: Low-Level Kill Ring,  Prev: Kill Functions,  Up: The Kill Ring
  414.  
  415. Functions for Yanking
  416. ---------------------
  417.  
  418.    "Yanking" means reinserting an entry of previously killed text from
  419. the kill ring.  The text properties are copied too.
  420.  
  421.  - Command: yank &optional ARG
  422.      This command inserts before point the text in the first entry in
  423.      the kill ring.  It positions the mark at the beginning of that
  424.      text, and point at the end.
  425.  
  426.      If ARG is a list (which occurs interactively when the user types
  427.      `C-u' with no digits), then `yank' inserts the text as described
  428.      above, but puts point before the yanked text and puts the mark
  429.      after it.
  430.  
  431.      If ARG is a number, then `yank' inserts the ARGth most recently
  432.      killed text--the ARGth element of the kill ring list.
  433.  
  434.      `yank' does not alter the contents of the kill ring or rotate it.
  435.      It returns `nil'.
  436.  
  437.  - Command: yank-pop ARG
  438.      This command replaces the just-yanked entry from the kill ring
  439.      with a different entry from the kill ring.
  440.  
  441.      This is allowed only immediately after a `yank' or another
  442.      `yank-pop'.  At such a time, the region contains text that was just
  443.      inserted by yanking.  `yank-pop' deletes that text and inserts in
  444.      its place a different piece of killed text.  It does not add the
  445.      deleted text to the kill ring, since it is already in the kill
  446.      ring somewhere.
  447.  
  448.      If ARG is `nil', then the replacement text is the previous element
  449.      of the kill ring.  If ARG is numeric, the replacement is the ARGth
  450.      previous kill.  If ARG is negative, a more recent kill is the
  451.      replacement.
  452.  
  453.      The sequence of kills in the kill ring wraps around, so that after
  454.      the oldest one comes the newest one, and before the newest one
  455.      goes the oldest.
  456.  
  457.      The value is always `nil'.
  458.  
  459. 
  460. File: lispref.info,  Node: Low-Level Kill Ring,  Next: Internals of Kill Ring,  Prev: Yank Commands,  Up: The Kill Ring
  461.  
  462. Low-Level Kill Ring
  463. -------------------
  464.  
  465.    These functions and variables provide access to the kill ring at a
  466. lower level, but still convenient for use in Lisp programs.  They take
  467. care of interaction with X Window selections.  They do not exist in
  468. Emacs version 18.
  469.  
  470.  - Function: current-kill N &optional DO-NOT-MOVE
  471.      The function `current-kill' rotates the yanking pointer which
  472.      designates the "front" of the kill ring by N places (from newer
  473.      kills to older ones), and returns the text at that place in the
  474.      ring.
  475.  
  476.      If the optional second argument DO-NOT-MOVE is non-`nil', then
  477.      `current-kill' doesn't alter the yanking pointer; it just returns
  478.      the Nth kill, counting from the current yanking pointer.
  479.  
  480.      If N is zero, indicating a request for the latest kill,
  481.      `current-kill' calls the value of `interprogram-paste-function'
  482.      (documented below) before consulting the kill ring.
  483.  
  484.  - Function: kill-new STRING
  485.      This function puts the text STRING into the kill ring as a new
  486.      entry at the front of the ring.  It discards the oldest entry if
  487.      appropriate.  It also invokes the value of
  488.      `interprogram-cut-function' (see below).
  489.  
  490.  - Function: kill-append STRING BEFORE-P
  491.      This function appends the text STRING to the first entry in the
  492.      kill ring.  Normally STRING goes at the end of the entry, but if
  493.      BEFORE-P is non-`nil', it goes at the beginning.  This function
  494.      also invokes the value of `interprogram-cut-function' (see below).
  495.  
  496.  - Variable: interprogram-paste-function
  497.      This variable provides a way of transferring killed text from other
  498.      programs, when you are using a window system.  Its value should be
  499.      `nil' or a function of no arguments.
  500.  
  501.      If the value is a function, `current-kill' calls it to get the
  502.      "most recent kill".  If the function returns a non-`nil' value,
  503.      then that value is used as the "most recent kill".  If it returns
  504.      `nil', then the first element of `kill-ring' is used.
  505.  
  506.      The normal use of this hook is to get the X server's primary
  507.      selection as the most recent kill, even if the selection belongs
  508.      to another X client.  *Note X Selections::.
  509.  
  510.  - Variable: interprogram-cut-function
  511.      This variable provides a way of communicating killed text to other
  512.      programs, when you are using a window system.  Its value should be
  513.      `nil' or a function of one argument.
  514.  
  515.      If the value is a function, `kill-new' and `kill-append' call it
  516.      with the new first element of the kill ring as an argument.
  517.  
  518.      The normal use of this hook is to set the X server's primary
  519.      selection to the newly killed text.
  520.  
  521. 
  522. File: lispref.info,  Node: Internals of Kill Ring,  Prev: Low-Level Kill Ring,  Up: The Kill Ring
  523.  
  524. Internals of the Kill Ring
  525. --------------------------
  526.  
  527.    The variable `kill-ring' holds the kill ring contents, in the form
  528. of a list of strings.  The most recent kill is always at the front of
  529. the list.
  530.  
  531.    The `kill-ring-yank-pointer' variable points to a link in the kill
  532. ring list, whose CAR is the text to yank next.  We say it identifies
  533. the "front" of the ring.  Moving `kill-ring-yank-pointer' to a
  534. different link is called "rotating the kill ring".  We call the kill
  535. ring a "ring" because the functions that move the yank pointer wrap
  536. around from the end of the list to the beginning, or vice-versa.
  537. Rotation of the kill ring is virtual; it does not change the value of
  538. `kill-ring'.
  539.  
  540.    Both `kill-ring' and `kill-ring-yank-pointer' are Lisp variables
  541. whose values are normally lists.  The word "pointer" in the name of the
  542. `kill-ring-yank-pointer' indicates that the variable's purpose is to
  543. identify one element of the list for use by the next yank command.
  544.  
  545.    The value of `kill-ring-yank-pointer' is always `eq' to one of the
  546. links in the kill ring list.  The element it identifies is the CAR of
  547. that link.  Kill commands, which change the kill ring, also set this
  548. variable to the value of `kill-ring'.  The effect is to rotate the ring
  549. so that the newly killed text is at the front.
  550.  
  551.    Here is a diagram that shows the variable `kill-ring-yank-pointer'
  552. pointing to the second entry in the kill ring `("some text" "a
  553. different piece of text" "yet older text")'.
  554.  
  555.      kill-ring       kill-ring-yank-pointer
  556.        |               |
  557.        |     ___ ___    --->  ___ ___      ___ ___
  558.         --> |___|___|------> |___|___|--> |___|___|--> nil
  559.               |                |            |
  560.               |                |            |
  561.               |                |             -->"yet older text"
  562.               |                |
  563.               |                 --> "a different piece of text"
  564.               |
  565.                --> "some text"
  566.  
  567. This state of affairs might occur after `C-y' (`yank') immediately
  568. followed by `M-y' (`yank-pop').
  569.  
  570.  - Variable: kill-ring
  571.      This variable holds the list of killed text sequences, most
  572.      recently killed first.
  573.  
  574.  - Variable: kill-ring-yank-pointer
  575.      This variable's value indicates which element of the kill ring is
  576.      at the "front" of the ring for yanking.  More precisely, the value
  577.      is a tail of the value of `kill-ring', and its CAR is the kill
  578.      string that `C-y' should yank.
  579.  
  580.  - User Option: kill-ring-max
  581.      The value of this variable is the maximum length to which the kill
  582.      ring can grow, before elements are thrown away at the end.  The
  583.      default value for `kill-ring-max' is 30.
  584.  
  585. 
  586. File: lispref.info,  Node: Undo,  Next: Maintaining Undo,  Prev: The Kill Ring,  Up: Text
  587.  
  588. Undo
  589. ====
  590.  
  591.    Most buffers have an "undo list", which records all changes made to
  592. the buffer's text so that they can be undone.  (The buffers that don't
  593. have one are usually special-purpose buffers for which XEmacs assumes
  594. that undoing is not useful.)  All the primitives that modify the text
  595. in the buffer automatically add elements to the front of the undo list,
  596. which is in the variable `buffer-undo-list'.
  597.  
  598.  - Variable: buffer-undo-list
  599.      This variable's value is the undo list of the current buffer.  A
  600.      value of `t' disables the recording of undo information.
  601.  
  602.    Here are the kinds of elements an undo list can have:
  603.  
  604. `INTEGER'
  605.      This kind of element records a previous value of point.  Ordinary
  606.      cursor motion does not get any sort of undo record, but deletion
  607.      commands use these entries to record where point was before the
  608.      command.
  609.  
  610. `(BEG . END)'
  611.      This kind of element indicates how to delete text that was
  612.      inserted.  Upon insertion, the text occupied the range BEG-END in
  613.      the buffer.
  614.  
  615. `(TEXT . POSITION)'
  616.      This kind of element indicates how to reinsert text that was
  617.      deleted.  The deleted text itself is the string TEXT.  The place to
  618.      reinsert it is `(abs POSITION)'.
  619.  
  620. `(t HIGH . LOW)'
  621.      This kind of element indicates that an unmodified buffer became
  622.      modified.  The elements HIGH and LOW are two integers, each
  623.      recording 16 bits of the visited file's modification time as of
  624.      when it was previously visited or saved.  `primitive-undo' uses
  625.      those values to determine whether to mark the buffer as unmodified
  626.      once again; it does so only if the file's modification time
  627.      matches those numbers.
  628.  
  629. `(nil PROPERTY VALUE BEG . END)'
  630.      This kind of element records a change in a text property.  Here's
  631.      how you might undo the change:
  632.  
  633.           (put-text-property BEG END PROPERTY VALUE)
  634.  
  635. `POSITION'
  636.      This element indicates where point was at an earlier time.
  637.      Undoing this element sets point to POSITION.  Deletion normally
  638.      creates an element of this kind as well as a reinsertion element.
  639.  
  640. `nil'
  641.      This element is a boundary.  The elements between two boundaries
  642.      are called a "change group"; normally, each change group
  643.      corresponds to one keyboard command, and undo commands normally
  644.      undo an entire group as a unit.
  645.  
  646.  - Function: undo-boundary
  647.      This function places a boundary element in the undo list.  The undo
  648.      command stops at such a boundary, and successive undo commands undo
  649.      to earlier and earlier boundaries.  This function returns `nil'.
  650.  
  651.      The editor command loop automatically creates an undo boundary
  652.      before each key sequence is executed.  Thus, each undo normally
  653.      undoes the effects of one command.  Self-inserting input
  654.      characters are an exception.  The command loop makes a boundary
  655.      for the first such character; the next 19 consecutive
  656.      self-inserting input characters do not make boundaries, and then
  657.      the 20th does, and so on as long as self-inserting characters
  658.      continue.
  659.  
  660.      All buffer modifications add a boundary whenever the previous
  661.      undoable change was made in some other buffer.  This way, a
  662.      command that modifies several buffers makes a boundary in each
  663.      buffer it changes.
  664.  
  665.      Calling this function explicitly is useful for splitting the
  666.      effects of a command into more than one unit.  For example,
  667.      `query-replace' calls `undo-boundary' after each replacement, so
  668.      that the user can undo individual replacements one by one.
  669.  
  670.  - Function: primitive-undo COUNT LIST
  671.      This is the basic function for undoing elements of an undo list.
  672.      It undoes the first COUNT elements of LIST, returning the rest of
  673.      LIST.  You could write this function in Lisp, but it is convenient
  674.      to have it in C.
  675.  
  676.      `primitive-undo' adds elements to the buffer's undo list when it
  677.      changes the buffer.  Undo commands avoid confusion by saving the
  678.      undo list value at the beginning of a sequence of undo operations.
  679.      Then the undo operations use and update the saved value.  The new
  680.      elements added by undoing are not part of this saved value, so
  681.      they don't interfere with continuing to undo.
  682.  
  683. 
  684. File: lispref.info,  Node: Maintaining Undo,  Next: Filling,  Prev: Undo,  Up: Text
  685.  
  686. Maintaining Undo Lists
  687. ======================
  688.  
  689.    This section describes how to enable and disable undo information for
  690. a given buffer.  It also explains how the undo list is truncated
  691. automatically so it doesn't get too big.
  692.  
  693.    Recording of undo information in a newly created buffer is normally
  694. enabled to start with; but if the buffer name starts with a space, the
  695. undo recording is initially disabled.  You can explicitly enable or
  696. disable undo recording with the following two functions, or by setting
  697. `buffer-undo-list' yourself.
  698.  
  699.  - Command: buffer-enable-undo &optional BUFFER-OR-NAME
  700.      This command enables recording undo information for buffer
  701.      BUFFER-OR-NAME, so that subsequent changes can be undone.  If no
  702.      argument is supplied, then the current buffer is used.  This
  703.      function does nothing if undo recording is already enabled in the
  704.      buffer.  It returns `nil'.
  705.  
  706.      In an interactive call, BUFFER-OR-NAME is the current buffer.  You
  707.      cannot specify any other buffer.
  708.  
  709.  - Function: buffer-disable-undo &optional BUFFER
  710.  - Function: buffer-flush-undo &optional BUFFER
  711.      This function discards the undo list of BUFFER, and disables
  712.      further recording of undo information.  As a result, it is no
  713.      longer possible to undo either previous changes or any subsequent
  714.      changes.  If the undo list of BUFFER is already disabled, this
  715.      function has no effect.
  716.  
  717.      This function returns `nil'.  It cannot be called interactively.
  718.  
  719.      The name `buffer-flush-undo' is not considered obsolete, but the
  720.      preferred name `buffer-disable-undo' is new as of Emacs versions
  721.      19.
  722.  
  723.    As editing continues, undo lists get longer and longer.  To prevent
  724. them from using up all available memory space, garbage collection trims
  725. them back to size limits you can set.  (For this purpose, the "size" of
  726. an undo list measures the cons cells that make up the list, plus the
  727. strings of deleted text.)  Two variables control the range of acceptable
  728. sizes: `undo-limit' and `undo-strong-limit'.
  729.  
  730.  - Variable: undo-limit
  731.      This is the soft limit for the acceptable size of an undo list.
  732.      The change group at which this size is exceeded is the last one
  733.      kept.
  734.  
  735.  - Variable: undo-strong-limit
  736.      This is the upper limit for the acceptable size of an undo list.
  737.      The change group at which this size is exceeded is discarded
  738.      itself (along with all older change groups).  There is one
  739.      exception: the very latest change group is never discarded no
  740.      matter how big it is.
  741.  
  742. 
  743. File: lispref.info,  Node: Filling,  Next: Margins,  Prev: Maintaining Undo,  Up: Text
  744.  
  745. Filling
  746. =======
  747.  
  748.    "Filling" means adjusting the lengths of lines (by moving the line
  749. breaks) so that they are nearly (but no greater than) a specified
  750. maximum width.  Additionally, lines can be "justified", which means
  751. inserting spaces to make the left and/or right margins line up
  752. precisely.  The width is controlled by the variable `fill-column'.  For
  753. ease of reading, lines should be no longer than 70 or so columns.
  754.  
  755.    You can use Auto Fill mode (*note Auto Filling::.) to fill text
  756. automatically as you insert it, but changes to existing text may leave
  757. it improperly filled.  Then you must fill the text explicitly.
  758.  
  759.    Most of the commands in this section return values that are not
  760. meaningful.  All the functions that do filling take note of the current
  761. left margin, current right margin, and current justification style
  762. (*note Margins::.).  If the current justification style is `none', the
  763. filling functions don't actually do anything.
  764.  
  765.    Several of the filling functions have an argument JUSTIFY.  If it is
  766. non-`nil', that requests some kind of justification.  It can be `left',
  767. `right', `full', or `center', to request a specific style of
  768. justification.  If it is `t', that means to use the current
  769. justification style for this part of the text (see
  770. `current-justification', below).
  771.  
  772.    When you call the filling functions interactively, using a prefix
  773. argument implies the value `full' for JUSTIFY.
  774.  
  775.  - Command: fill-paragraph JUSTIFY
  776.      This command fills the paragraph at or after point.  If JUSTIFY is
  777.      non-`nil', each line is justified as well.  It uses the ordinary
  778.      paragraph motion commands to find paragraph boundaries.  *Note
  779.      Paragraphs: (emacs)Paragraphs.
  780.  
  781.  - Command: fill-region START END &optional JUSTIFY
  782.      This command fills each of the paragraphs in the region from START
  783.      to END.  It justifies as well if JUSTIFY is non-`nil'.
  784.  
  785.      The variable `paragraph-separate' controls how to distinguish
  786.      paragraphs.  *Note Standard Regexps::.
  787.  
  788.  - Command: fill-individual-paragraphs START END &optional JUSTIFY
  789.           MAIL-FLAG
  790.      This command fills each paragraph in the region according to its
  791.      individual fill prefix.  Thus, if the lines of a paragraph were
  792.      indented with spaces, the filled paragraph will remain indented in
  793.      the same fashion.
  794.  
  795.      The first two arguments, START and END, are the beginning and end
  796.      of the region to be filled.  The third and fourth arguments,
  797.      JUSTIFY and MAIL-FLAG, are optional.  If JUSTIFY is non-`nil', the
  798.      paragraphs are justified as well as filled.  If MAIL-FLAG is
  799.      non-`nil', it means the function is operating on a mail message
  800.      and therefore should not fill the header lines.
  801.  
  802.      Ordinarily, `fill-individual-paragraphs' regards each change in
  803.      indentation as starting a new paragraph.  If
  804.      `fill-individual-varying-indent' is non-`nil', then only separator
  805.      lines separate paragraphs.  That mode can handle indented
  806.      paragraphs with additional indentation on the first line.
  807.  
  808.  - User Option: fill-individual-varying-indent
  809.      This variable alters the action of `fill-individual-paragraphs' as
  810.      described above.
  811.  
  812.  - Command: fill-region-as-paragraph START END &optional JUSTIFY
  813.      This command considers a region of text as a paragraph and fills
  814.      it.  If the region was made up of many paragraphs, the blank lines
  815.      between paragraphs are removed.  This function justifies as well
  816.      as filling when JUSTIFY is non-`nil'.
  817.  
  818.      In an interactive call, any prefix argument requests justification.
  819.  
  820.      In Adaptive Fill mode, which is enabled by default,
  821.      `fill-region-as-paragraph' on an indented paragraph when there is
  822.      no fill prefix uses the indentation of the second line of the
  823.      paragraph as the fill prefix.
  824.  
  825.  - Command: justify-current-line HOW EOP NOSQUEEZE
  826.      This command inserts spaces between the words of the current line
  827.      so that the line ends exactly at `fill-column'.  It returns `nil'.
  828.  
  829.      The argument HOW, if non-`nil' specifies explicitly the style of
  830.      justification.  It can be `left', `right', `full', `center', or
  831.      `none'.  If it is `t', that means to do follow specified
  832.      justification style (see `current-justification', below).  `nil'
  833.      means to do full justification.
  834.  
  835.      If EOP is non-`nil', that means do left-justification when
  836.      `current-justification' specifies full justification.  This is used
  837.      for the last line of a paragraph; even if the paragraph as a whole
  838.      is fully justified, the last line should not be.
  839.  
  840.      If NOSQUEEZE is non-`nil', that means do not change interior
  841.      whitespace.
  842.  
  843.  - User Option: default-justification
  844.      This variable's value specifies the style of justification to use
  845.      for text that doesn't specify a style with a text property.  The
  846.      possible values are `left', `right', `full', `center', or `none'.
  847.      The default value is `left'.
  848.  
  849.  - Function: current-justification
  850.      This function returns the proper justification style to use for
  851.      filling the text around point.
  852.  
  853.  - Variable: fill-paragraph-function
  854.      This variable provides a way for major modes to override the
  855.      filling of paragraphs.  If the value is non-`nil',
  856.      `fill-paragraph' calls this function to do the work.  If the
  857.      function returns a non-`nil' value, `fill-paragraph' assumes the
  858.      job is done, and immediately returns that value.
  859.  
  860.      The usual use of this feature is to fill comments in programming
  861.      language modes.  If the function needs to fill a paragraph in the
  862.      usual way, it can do so as follows:
  863.  
  864.           (let ((fill-paragraph-function nil))
  865.             (fill-paragraph arg))
  866.  
  867.  - Variable: use-hard-newlines
  868.      If this variable is non-`nil', the filling functions do not delete
  869.      newlines that have the `hard' text property.  These "hard
  870.      newlines" act as paragraph separators.
  871.  
  872. 
  873. File: lispref.info,  Node: Margins,  Next: Auto Filling,  Prev: Filling,  Up: Text
  874.  
  875. Margins for Filling
  876. ===================
  877.  
  878.  - User Option: fill-prefix
  879.      This variable specifies a string of text that appears at the
  880.      beginning of normal text lines and should be disregarded when
  881.      filling them.  Any line that fails to start with the fill prefix
  882.      is considered the start of a paragraph; so is any line that starts
  883.      with the fill prefix followed by additional whitespace.  Lines
  884.      that start with the fill prefix but no additional whitespace are
  885.      ordinary text lines that can be filled together.  The resulting
  886.      filled lines also start with the fill prefix.
  887.  
  888.      The fill prefix follows the left margin whitespace, if any.
  889.  
  890.  - User Option: fill-column
  891.      This buffer-local variable specifies the maximum width of filled
  892.      lines.  Its value should be an integer, which is a number of
  893.      columns.  All the filling, justification and centering commands
  894.      are affected by this variable, including Auto Fill mode (*note
  895.      Auto Filling::.).
  896.  
  897.      As a practical matter, if you are writing text for other people to
  898.      read, you should set `fill-column' to no more than 70.  Otherwise
  899.      the line will be too long for people to read comfortably, and this
  900.      can make the text seem clumsy.
  901.  
  902.  - Variable: default-fill-column
  903.      The value of this variable is the default value for `fill-column'
  904.      in buffers that do not override it.  This is the same as
  905.      `(default-value 'fill-column)'.
  906.  
  907.      The default value for `default-fill-column' is 70.
  908.  
  909.  - Command: set-left-margin FROM TO MARGIN
  910.      This sets the `left-margin' property on the text from FROM to TO
  911.      to the value MARGIN.  If Auto Fill mode is enabled, this command
  912.      also refills the region to fit the new margin.
  913.  
  914.  - Command: set-right-margin FROM TO MARGIN
  915.      This sets the `right-margin' property on the text from FROM to TO
  916.      to the value MARGIN.  If Auto Fill mode is enabled, this command
  917.      also refills the region to fit the new margin.
  918.  
  919.  - Function: current-left-margin
  920.      This function returns the proper left margin value to use for
  921.      filling the text around point.  The value is the sum of the
  922.      `left-margin' property of the character at the start of the
  923.      current line (or zero if none), and the value of the variable
  924.      `left-margin'.
  925.  
  926.  - Function: current-fill-column
  927.      This function returns the proper fill column value to use for
  928.      filling the text around point.  The value is the value of the
  929.      `fill-column' variable, minus the value of the `right-margin'
  930.      property of the character after point.
  931.  
  932.  - Command: move-to-left-margin &optional N FORCE
  933.      This function moves point to the left margin of the current line.
  934.      The column moved to is determined by calling the function
  935.      `current-left-margin'.  If the argument N is non-`nil',
  936.      `move-to-left-margin' moves forward N-1 lines first.
  937.  
  938.      If FORCE is non-`nil', that says to fix the line's indentation if
  939.      that doesn't match the left margin value.
  940.  
  941.  - Function: delete-to-left-margin FROM TO
  942.      This function removes left margin indentation from the text
  943.      between FROM and TO.  The amount of indentation to delete is
  944.      determined by calling `current-left-margin'.  In no case does this
  945.      function delete non-whitespace.
  946.  
  947.  - Function: indent-to-left-margin
  948.      This is the default `indent-line-function', used in Fundamental
  949.      mode, Text mode, etc.  Its effect is to adjust the indentation at
  950.      the beginning of the current line to the value specified by the
  951.      variable `left-margin'.  This may involve either inserting or
  952.      deleting whitespace.
  953.  
  954.  - Variable: left-margin
  955.      This variable specifies the base left margin column.  In
  956.      Fundamental mode, LFD indents to this column.  This variable
  957.      automatically becomes buffer-local when set in any fashion.
  958.  
  959. 
  960. File: lispref.info,  Node: Auto Filling,  Next: Sorting,  Prev: Margins,  Up: Text
  961.  
  962. Auto Filling
  963. ============
  964.  
  965.    Auto Fill mode is a minor mode that fills lines automatically as text
  966. is inserted.  This section describes the hook used by Auto Fill mode.
  967. For a description of functions that you can call explicitly to fill and
  968. justify existing text, see *Note Filling::.
  969.  
  970.    Auto Fill mode also enables the functions that change the margins and
  971. justification style to refill portions of the text.  *Note Margins::.
  972.  
  973.  - Variable: auto-fill-function
  974.      The value of this variable should be a function (of no arguments)
  975.      to be called after self-inserting a space or a newline.  It may be
  976.      `nil', in which case nothing special is done in that case.
  977.  
  978.      The value of `auto-fill-function' is `do-auto-fill' when Auto-Fill
  979.      mode is enabled.  That is a function whose sole purpose is to
  980.      implement the usual strategy for breaking a line.
  981.  
  982.           In older Emacs versions, this variable was named
  983.           `auto-fill-hook', but since it is not called with the
  984.           standard convention for hooks, it was renamed to
  985.           `auto-fill-function' in version 19.
  986.  
  987.